<script setup lang="ts">
import { onMounted } from 'vue'
import { useData } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import agentWeChat from './components/agentWeChat.vue';
import { theme, ConfigProvider } from 'ant-design-vue';
import Login from './components/Login/index.vue';
import { useUserStore } from '../../stores/user'
import Logintime from './components/mycomponents/logintime.vue';

const { isDark } = useData()
const userStore = useUserStore()
onMounted(() => {
  userStore.initGetSysOs()
  userStore.initLoginUserInfo()
  getuseRouter()
})
function getuseRouter() {
  const usrlParams = new URLSearchParams(location.search)
  const i = usrlParams.get('i')
  console.log('i', i)
  if (i && i === '1') {
    // 调用检查是否登陆的接口
    userStore.isShareLink(() => {
      console.log('已登录')
    })
  }
}

</script>

<template>
  <ConfigProvider :theme="{
    algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,
  }">
    <DefaultTheme.Layout>
      <template #aside-ads-after>
        <agentWeChat />
      </template>
      <template #home-hero-image>
        <Logintime />
      </template>
    </DefaultTheme.Layout>
    <Login />
  </ConfigProvider>
</template>